<!DOCTYPE >
<html>
	<html lang="ch">
	<head>
		<title>简易银行注册</title>
		<meta charset="utf-8">
		<style type="text/css">
			#lunkuo{
				position: absolute;
				top: 50%;/*顶部到元素*/
				left:30%;
				width: 40%;
				height:420px;
				margin-top:-200;/*边缘到底部*/
				background-color: #f0a1a8;
				text-align-last: center;
				filter:alpha(Opacity=60);
				moz-opacity:0.6;
				opacity: 0.6;
			}
			#lunkuo input{
				font-size: 20px;
				text-align: center;
				border-radius: 25px;
			}
			#button{
				background-color: #3498db;
				border-radius:10px;
             	border:0;/*边框宽度0*/
            	height:50px;
             	width:90px;
            	padding:5px 10px;/*上下填充10 左右5*/
            	font-size: 20px;
			}
		</style>
	</head>
	<body background="img/zcbg.jpg" onload="fun()">
		<div id="lunkuo">
			<h1>注册</h1><br />
			<form action="#"  method="post">
				<svg t="1586146954028" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="2643" width="23" height="23"><path d="M904.4 346.2c-21.5-50.7-52.2-96.3-91.3-135.4-39.1-39.1-84.6-69.8-135.4-91.3C625.3 97.4 569.5 86.1 512 86.1s-113.3 11.3-165.8 33.5c-50.7 21.5-96.3 52.2-135.4 91.3-39.1 39.1-69.8 84.6-91.3 135.4C97.4 398.7 86.1 454.5 86.1 512c0 57.5 11.3 113.3 33.5 165.8 21.5 50.7 52.2 96.3 91.3 135.4 39.1 39.1 84.6 69.8 135.4 91.3 52.5 22.2 108.3 33.5 165.8 33.5s113.3-11.3 165.8-33.5c50.7-21.5 96.3-52.2 135.4-91.3 39.1-39.1 69.8-84.6 91.3-135.4 22.2-52.5 33.5-108.3 33.5-165.8-0.2-57.5-11.5-113.3-33.7-165.8zM770.7 770.7c-69.1 69.1-161 107.2-258.7 107.2s-189.6-38.1-258.7-107.2-107.2-161-107.2-258.7 38.1-189.6 107.2-258.7 161-107.2 258.7-107.2 189.6 38.1 258.7 107.2 107.2 161 107.2 258.7-38.1 189.6-107.2 258.7z" p-id="2644"></path><path d="M618.9 552.8c47.3-33.6 78.2-88.7 78.2-151 0-102-83-185.1-185.1-185.1s-185.1 83-185.1 185.1c0 62.3 30.9 117.4 78.2 151-67.5 32.9-118.4 96-133.4 173.5-3.1 16.3 7.5 32 23.8 35.1 1.9 0.4 3.8 0.5 5.7 0.5 14.1 0 26.7-10 29.4-24.3 16.7-86.6 93-149.5 181.3-149.5 88.4 0 164.6 62.9 181.3 149.5 3.1 16.3 18.9 26.9 35.1 23.8 16.3-3.1 26.9-18.9 23.8-35.1-14.8-77.6-65.7-140.7-133.2-173.5zM512 276.7c69 0 125.1 56.1 125.1 125.1s-56.1 125-125.1 125-125.1-56.1-125.1-125.1 56.1-125 125.1-125z" p-id="2645"></path></svg>
				<input type="text" name="username" id="username"  placeholder="用户名"/><span style="color: red;"></span><br /><br />
				<svg t="1586146954028" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="2643" width="23" height="23"><path d="M904.4 346.2c-21.5-50.7-52.2-96.3-91.3-135.4-39.1-39.1-84.6-69.8-135.4-91.3C625.3 97.4 569.5 86.1 512 86.1s-113.3 11.3-165.8 33.5c-50.7 21.5-96.3 52.2-135.4 91.3-39.1 39.1-69.8 84.6-91.3 135.4C97.4 398.7 86.1 454.5 86.1 512c0 57.5 11.3 113.3 33.5 165.8 21.5 50.7 52.2 96.3 91.3 135.4 39.1 39.1 84.6 69.8 135.4 91.3 52.5 22.2 108.3 33.5 165.8 33.5s113.3-11.3 165.8-33.5c50.7-21.5 96.3-52.2 135.4-91.3 39.1-39.1 69.8-84.6 91.3-135.4 22.2-52.5 33.5-108.3 33.5-165.8-0.2-57.5-11.5-113.3-33.7-165.8zM770.7 770.7c-69.1 69.1-161 107.2-258.7 107.2s-189.6-38.1-258.7-107.2-107.2-161-107.2-258.7 38.1-189.6 107.2-258.7 161-107.2 258.7-107.2 189.6 38.1 258.7 107.2 107.2 161 107.2 258.7-38.1 189.6-107.2 258.7z" p-id="2644"></path><path d="M618.9 552.8c47.3-33.6 78.2-88.7 78.2-151 0-102-83-185.1-185.1-185.1s-185.1 83-185.1 185.1c0 62.3 30.9 117.4 78.2 151-67.5 32.9-118.4 96-133.4 173.5-3.1 16.3 7.5 32 23.8 35.1 1.9 0.4 3.8 0.5 5.7 0.5 14.1 0 26.7-10 29.4-24.3 16.7-86.6 93-149.5 181.3-149.5 88.4 0 164.6 62.9 181.3 149.5 3.1 16.3 18.9 26.9 35.1 23.8 16.3-3.1 26.9-18.9 23.8-35.1-14.8-77.6-65.7-140.7-133.2-173.5zM512 276.7c69 0 125.1 56.1 125.1 125.1s-56.1 125-125.1 125-125.1-56.1-125.1-125.1 56.1-125 125.1-125z" p-id="2645"></path></svg>
				<input type="text" name="uid" id="uid"  placeholder="银行卡号"/><span style="color: red;"></span><br /><br/>
				<svg t="1586146995954" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="3403" width="23" height="23"><path d="M512 128a170.666667 170.666667 0 0 0-170.666667 170.666667v128h341.333334V298.666667a170.666667 170.666667 0 0 0-162.133334-170.453334L512 128z m298.666667 384H213.333333a42.666667 42.666667 0 0 0-42.666666 42.666667v298.666666a42.666667 42.666667 0 0 0 42.666666 42.666667h597.333334a42.666667 42.666667 0 0 0 42.666666-42.666667v-298.666666a42.666667 42.666667 0 0 0-42.666666-42.666667zM512 42.666667a256 256 0 0 1 256 256v128h42.666667a128 128 0 0 1 128 128v298.666666a128 128 0 0 1-128 128H213.333333a128 128 0 0 1-128-128v-298.666666a128 128 0 0 1 128-128h42.666667V298.666667a256 256 0 0 1 246.4-255.829334L512 42.666667z" p-id="3404"></path></svg>
				<input type="password" name="password1" id="password" placeholder="密码:6-12位" /><span style="color: red;"></span><br /><br />
				<svg t="1586147123231" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="5214" width="23" height="23"><path d="M512 572.8c-48 0-88 40-88 88 0 41.6 28.8 76.8 67.2 84.8v75.2c0 11.2 8 19.2 19.2 19.2h3.2c11.2 0 19.2-8 19.2-19.2v-75.2c38.4-9.6 67.2-44.8 67.2-84.8 0-48-40-88-88-88z m0 134.4c-25.6 0-46.4-20.8-46.4-46.4s20.8-46.4 46.4-46.4 46.4 20.8 46.4 46.4-20.8 46.4-46.4 46.4z" fill="#3E3A39" p-id="5215"></path><path d="M780.8 448h-3.2v-118.4c0-145.6-118.4-264-264-264s-264 118.4-264 264V448h-4.8C188.8 448 144 492.8 144 547.2v313.6c0 54.4 44.8 99.2 99.2 99.2h537.6c54.4 0 99.2-44.8 99.2-99.2V547.2c0-54.4-44.8-99.2-99.2-99.2z m-484.8-118.4c0-120 97.6-216 216-216s216 97.6 216 216V448h-432v-118.4zM832 860.8c0 28.8-22.4 51.2-51.2 51.2H243.2c-28.8 0-51.2-22.4-51.2-51.2V547.2c0-28.8 22.4-51.2 51.2-51.2h537.6c28.8 0 51.2 22.4 51.2 51.2v313.6z" fill="#3E3A39" p-id="5216"></path></svg>
				<input type="password" name="password2" id="repassword" placeholder="请再次确认密码" /><span style="color: red;"></span><br /><br />
				<input type="button" id="button" value="开户" onclick="register()">
			</form>

		</div>
        <script>
            function getCookie(cookieName) {
                const strCookie = document.cookie
                const cookieList = strCookie.split(';')
                for(let i = 0; i < cookieList.length; i++) {
                    const arr = cookieList[i].split('=')
                    if (cookieName === arr[0].trim()) {
                        return arr[1];
                    }
                }
                return '';
            }

            function register(){
                // 打开http post请求
                var url = "http://139.9.84.117:5000/account/open";
                var httpRequest = new XMLHttpRequest();
		    httpRequest.withCredentials = true;
                httpRequest.open('POST', url, true);
                httpRequest.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
                // 获取信息
                var username = document.getElementById("username");
                var bankcard = document.getElementById("uid");
                var password = document.getElementById("password");
                if(username.length == 0 || password.length == 0 || bankcard.length == 0) {
                    alert("注册信息不能为空");
                }
                var objStr = "uid=" + bankcard.value + "&username=" + username.value + "&password=" + password.value;
                // alert(objStr);
                httpRequest.send(objStr);
                // 回调函数
                httpRequest.onreadystatechange = function(){
                	if(httpRequest.readyState == 4 && httpRequest.status == 200) {
						var responseText = httpRequest.responseText;
						if(responseText == "success"){
							alert("注册成功！");
	                    	window.location.href="manage.html";
						} else {
							alert(responseText);
						}
                	}
                }
            }
        </script>
	</body>
</html>
